From: Keir Fraser Date: Tue, 1 Sep 2009 10:36:16 +0000 (+0100) Subject: x86 passthru:: graphics passthrough X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13397 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=049607ff3386ed38060862733cb63a6799571a28;p=xen.git x86 passthru:: graphics passthrough This patch supports basic gfx passthrough on xen side: - add a VGA type for gfx passthrough, and get the size of VGA bios of passthrouged gfx in hvmloader - add a config option 'gfx_passthru' for gfx passthrough Signed-off-by: Ben Lin Signed-off-by: Weidong Han --- diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index c154eff952..581bcafc52 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -113,7 +113,7 @@ asm ( unsigned long pci_mem_start = PCI_MEM_START; unsigned long pci_mem_end = PCI_MEM_END; -static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none; +static enum { VGA_none, VGA_std, VGA_cirrus, VGA_pt } virtual_vga = VGA_none; static void init_hypercalls(void) { @@ -212,8 +212,10 @@ static void pci_setup(void) case 0x0300: if ( (vendor_id == 0x1234) && (device_id == 0x1111) ) virtual_vga = VGA_std; - if ( (vendor_id == 0x1013) && (device_id == 0xb8) ) + else if ( (vendor_id == 0x1013) && (device_id == 0xb8) ) virtual_vga = VGA_cirrus; + else + virtual_vga = VGA_pt; break; case 0x0680: /* PIIX4 ACPI PM. Special device with special PCI config space. */ @@ -685,6 +687,11 @@ int main(void) vgabios_stdvga, sizeof(vgabios_stdvga)); vgabios_sz = round_option_rom(sizeof(vgabios_stdvga)); break; + case VGA_pt: + printf("Loading VGABIOS of passthroughed gfx ...\n"); + vgabios_sz = + round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512); + break; default: printf("No emulated VGA adaptor ...\n"); break; diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py index 6f39e7ed1a..06291a2ecf 100644 --- a/tools/python/xen/xend/XendConfig.py +++ b/tools/python/xen/xend/XendConfig.py @@ -175,6 +175,7 @@ XENAPI_PLATFORM_CFG_TYPES = { 'pci_msitranslate': int, 'pci_power_mgmt': int, 'xen_platform_pci': int, + "gfx_passthru": int, } # Xen API console 'other_config' keys. diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index 0e9abd9726..5d1a0f4dff 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -807,7 +807,7 @@ class HVMImageHandler(ImageHandler): dmargs = [ 'boot', 'fda', 'fdb', 'soundhw', 'localtime', 'serial', 'stdvga', 'isa', - 'acpi', 'usb', 'usbdevice' ] + 'acpi', 'usb', 'usbdevice', 'gfx_passthru' ] for a in dmargs: v = vmConfig['platform'].get(a) diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index 92ab12b0fa..d7ed07b3c6 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -547,6 +547,10 @@ gopts.var('sdl', val='', fn=set_value, default=None, use="""Should the device model use SDL?""") +gopts.var('gfx_passthru', val='', + fn=set_value, default=None, + use="""Passthrough graphics card?""") + gopts.var('opengl', val='', fn=set_value, default=None, use="""Enable\Disable OpenGL""") @@ -957,7 +961,8 @@ def configure_hvm(config_image, vals): 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet', 'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check', 'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate', - 'vpt_align', 'pci_power_mgmt', 'xen_platform_pci' ] + 'vpt_align', 'pci_power_mgmt', 'xen_platform_pci', + 'gfx_passthru' ] for a in args: if a in vals.__dict__ and vals.__dict__[a] is not None: